/*     */ package eos.moe.dragoncore;
/*     */ 
/*     */ import com.mojang.authlib.GameProfile;
/*     */ import java.awt.Color;
/*     */ import java.util.Locale;
/*     */ import java.util.UUID;
/*     */ import net.minecraft.client.Minecraft;
/*     */ import net.minecraft.client.entity.EntityOtherPlayerMP;
/*     */ import net.minecraft.client.model.ModelBase;
/*     */ import net.minecraft.client.model.ModelPlayer;
/*     */ import net.minecraft.client.renderer.GlStateManager;
/*     */ import net.minecraft.client.renderer.OpenGlHelper;
/*     */ import net.minecraft.client.renderer.RenderHelper;
/*     */ import net.minecraft.client.renderer.entity.Render;
/*     */ import net.minecraft.client.renderer.entity.RenderLivingBase;
/*     */ import net.minecraft.client.renderer.entity.RenderManager;
/*     */ import net.minecraft.entity.Entity;
/*     */ import net.minecraft.entity.EntityList;
/*     */ import net.minecraft.entity.EntityLivingBase;
/*     */ import net.minecraft.entity.item.EntityArmorStand;
/*     */ import net.minecraft.world.World;
/*     */ import net.minecraftforge.client.event.RenderLivingEvent;
/*     */ import net.minecraftforge.fml.client.FMLClientHandler;
/*     */ import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
/*     */ import net.minecraftforge.fml.common.eventhandler.EventPriority;
/*     */ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
/*     */ import org.yaml.snakeyamla.configuration.ConfigurationSection;
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ @EventBusSubscriber(modid = "dragoncore")
/*     */ public class hm
/*     */   extends pi
/*     */ {
/*     */   private bh ta;
/*     */   private Entity j;
/*     */   private bh c;
/*     */   private bh r;
/*     */   private EntityLivingBase z;
/*     */   private bh i;
/*     */   private bh w;
/*     */   private String q;
/*     */   
/*     */   public hm(vh vh1, ConfigurationSection configurationSection) {
/*  52 */     super(vh1, configurationSection);
/*  53 */     this.ta = createMoLangParserString("entity", "owner");
/*  54 */     this.c = createMoLangParser("head", Boolean.valueOf(false));
/*  55 */     this.r = createMoLangParser("followMouse", Boolean.valueOf(true));
/*  56 */     this.i = createMoLangParser("hideName", Boolean.valueOf(false));
/*  57 */     this.w = createMoLangParserString("model", "armor_stand");
/*     */   }
/*     */ 
/*     */   
/*     */   public void render(int i, int j) {
/*  62 */     Entity entity = getEntity(this.ta.v());
/*  63 */     if (entity != null && (Minecraft.func_71410_x().func_175598_ae()).field_78734_h != null && 
/*  64 */       entity instanceof EntityLivingBase) {
/*  65 */       if (this.ta.isHud() && !((Minecraft.func_71410_x()).field_71462_r instanceof net.minecraft.client.gui.GuiChat)) {
/*  66 */         i = (int)(getXPos() + this.c);
/*  67 */         j = (int)(getYPos() + this.r - 50.0D * this.ia.z());
/*     */       } 
/*     */ 
/*     */ 
/*     */ 
/*     */       
/*  73 */       if ((Minecraft.func_71410_x()).field_71441_e.func_73045_a(entity.func_145782_y()) != entity) {
/*  74 */         zz zz = kq.q.getEntityManager(entity.func_110124_au());
/*  75 */         if (zz != null) {
/*  76 */           kq.q.startAnimation(zz, "idle", 0, 1.0F);
/*     */         }
/*     */       } 
/*     */ 
/*     */       
/*  81 */       drawEntityOnScreen(0, 0, 30, 
/*  82 */           getXPos() + this.c - i, 
/*  83 */           getYPos() + this.r - 50.0D * this.ia.z() - j, (EntityLivingBase)entity);
/*     */     } 
/*     */   }
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   
/*     */   public void renderDebug(int i, int j) {
/*  92 */     boolean bool = isHovered(i, j);
/*  93 */     double d1 = 30.0D;
/*  94 */     double d2 = 60.0D;
/*  95 */     if (bool) {
/*  96 */       jo.v(0.0D - d1 / 2.0D, -60.0D, d1, d2, 1.0D, new Color(247, 49, 49, 255));
/*     */     } else {
/*  98 */       jo.v(0.0D - d1 / 2.0D, -60.0D, d1, d2, 1.0D, new Color(71, 145, 255, 255));
/*     */     } 
/*     */   }
/*     */   
/*     */   public Entity getEntity(String str) {
/* 103 */     switch (str) {
/*     */       case "owner":
/* 105 */         return (Entity)(Minecraft.func_71410_x()).field_71439_g;
/*     */       case "aim":
/* 107 */         if ((Minecraft.func_71410_x()).field_71476_x != null) {
/* 108 */           return (Minecraft.func_71410_x()).field_71476_x.field_72308_g;
/*     */         }
/* 110 */         return null;
/*     */       case "firstaim":
/* 112 */         if (this.j == null && (Minecraft.func_71410_x()).field_71476_x != null) {
/* 113 */           this.j = (Minecraft.func_71410_x()).field_71476_x.field_72308_g;
/*     */         }
/* 115 */         return this.j;
/*     */     } 
/*     */     
/*     */     try {
/* 119 */       int i = Integer.parseInt(str);
/* 120 */       for (Entity entity : (Minecraft.func_71410_x()).field_71441_e.func_72910_y()) {
/* 121 */         if (entity.func_145782_y() == i) {
/* 122 */           return entity;
/*     */         }
/*     */       } 
/* 125 */     } catch (NumberFormatException numberFormatException) {
/*     */       try {
/* 127 */         UUID uUID = UUID.fromString(str);
/* 128 */         for (Entity entity : (Minecraft.func_71410_x()).field_71441_e.func_72910_y()) {
/* 129 */           if (uUID.equals(entity.func_110124_au())) {
/* 130 */             return entity;
/*     */           }
/*     */         } 
/* 133 */       } catch (Exception exception) {
/* 134 */         String str1 = this.w.v();
/* 135 */         if (!str1.equals(this.q)) {
/* 136 */           this.z = null;
/* 137 */           this.q = str1;
/*     */         } 
/* 139 */         if (this.z == null) {
/* 140 */           if (str1.equals("player")) {
/* 141 */             this.z = (EntityLivingBase)new EntityOtherPlayerMP((World)FMLClientHandler.instance().getWorldClient(), new GameProfile(UUID.randomUUID(), str));
/*     */           } else {
/* 143 */             Class<EntityArmorStand> clazz = EntityList.func_192839_a(str1);
/* 144 */             if (clazz == null) {
/* 145 */               clazz = EntityArmorStand.class;
/*     */             }
/*     */             try {
/* 148 */               this.z = clazz.getConstructor(new Class[] { World.class }).newInstance(new Object[] { FMLClientHandler.instance().getWorldClient() });
/* 149 */             } catch (Exception exception1) {
/* 150 */               this.z = (EntityLivingBase)new EntityArmorStand((World)FMLClientHandler.instance().getWorldClient());
/*     */             } 
/*     */           } 
/* 153 */           this.z.func_174805_g(true);
/*     */         } 
/* 155 */         this.z.field_70165_t = (Minecraft.func_71410_x().func_175598_ae()).field_78734_h.field_70165_t;
/* 156 */         this.z.field_70163_u = (Minecraft.func_71410_x().func_175598_ae()).field_78734_h.field_70163_u;
/* 157 */         this.z.field_70161_v = (Minecraft.func_71410_x().func_175598_ae()).field_78734_h.field_70161_v;
/*     */         
/* 159 */         this.z.func_96094_a(str);
/* 160 */         return (Entity)this.z;
/*     */       } 
/*     */     } 
/*     */     
/* 164 */     return null;
/*     */   }
/*     */ 
/*     */ 
/*     */   
/*     */   public boolean isHovered(int i, int j) {
/* 170 */     if (!this.sa.z()) {
/* 171 */       return false;
/*     */     }
/*     */     
/* 174 */     if (this.k.z() != 0.0D && this.o.z() != 0.0D && 
/* 175 */       !sk.v(i, j, getLimitXPos(), getLimitYPos(), this.k.z(), this.o.z())) {
/* 176 */       return false;
/*     */     }
/*     */     
/* 179 */     return sk.v(i, j, getXPos() + this.c - 15.0D * this.ia.z(), getYPos() + this.r - 60.0D * this.ia.z(), 30.0D * this.ia.z(), 60.0D * this.ia.z());
/*     */   }
/*     */ 
/*     */   
/*     */   public double getWidth() {
/* 184 */     return 30.0D;
/*     */   }
/*     */ 
/*     */ 
/*     */   
/*     */   public void cache(int i, int j) {
/* 190 */     super.cache(i, j);
/* 191 */     this.ta.z();
/* 192 */     this.c.z();
/* 193 */     this.r.z();
/* 194 */     this.i.z();
/* 195 */     this.w.z();
/*     */   }
/*     */ 
/*     */   
/*     */   public Object getValue(String str) {
/* 200 */     switch (str.toLowerCase(Locale.ROOT)) {
/*     */       case "type":
/*     */       case "type_":
/* 203 */         return "entity";
/*     */       case "head":
/* 205 */         return this.c.z();
/*     */       case "followmouse":
/* 207 */         return this.r.z();
/*     */       case "height":
/*     */       case "height_":
/* 210 */         return "60";
/*     */       case "width":
/*     */       case "width_":
/* 213 */         return "30";
/*     */       case "entity":
/* 215 */         return this.ta.z();
/*     */       case "hidename":
/* 217 */         return this.i.z();
/*     */       case "hidename_":
/* 219 */         return this.i.h();
/*     */       
/*     */       case "head_":
/* 222 */         return this.c.h();
/*     */       case "followmouse_":
/* 224 */         return this.r.h();
/*     */       case "entity_":
/* 226 */         return this.ta.h();
/*     */     } 
/* 228 */     return super.getValue(str);
/*     */   }
/*     */ 
/*     */   
/*     */   public void setValue(String str, Object object) {
/* 233 */     switch (str.toLowerCase(Locale.ROOT)) {
/*     */       case "entity":
/* 235 */         this.ta = toMolangParser((String)object);
/*     */         return;
/*     */       case "head":
/* 238 */         this.c = toMolangParser(object);
/*     */         return;
/*     */       case "followmouse":
/* 241 */         this.r = toMolangParser(object);
/*     */         return;
/*     */       case "hidename":
/* 244 */         this.i = toMolangParser(object);
/*     */         return;
/*     */     } 
/* 247 */     super.setValue(str, object);
/*     */   }
/*     */ 
/*     */   
/*     */   public void drawEntityOnScreen(int i, int j, int k, double d1, double d2, EntityLivingBase entityLivingBase) {
/* 252 */     boolean bool = this.r.v();
/*     */     
/* 254 */     GlStateManager.func_179131_c(1.0F, 1.0F, 1.0F, jo.v());
/* 255 */     GlStateManager.func_179142_g();
/* 256 */     GlStateManager.func_179094_E();
/* 257 */     GlStateManager.func_179109_b(i, j, 50.0F);
/* 258 */     GlStateManager.func_179152_a(-k, k, k);
/* 259 */     GlStateManager.func_179114_b(180.0F, 0.0F, 0.0F, 1.0F);
/* 260 */     float f1 = entityLivingBase.field_70761_aq;
/* 261 */     float f2 = entityLivingBase.field_70177_z;
/* 262 */     float f3 = entityLivingBase.field_70125_A;
/* 263 */     float f4 = entityLivingBase.field_70758_at;
/* 264 */     float f5 = entityLivingBase.field_70759_as;
/* 265 */     GlStateManager.func_179114_b(135.0F, 0.0F, 1.0F, 0.0F);
/* 266 */     RenderHelper.func_74519_b();
/* 267 */     GlStateManager.func_179114_b(-135.0F, 0.0F, 1.0F, 0.0F);
/*     */     
/* 269 */     if (bool) {
/* 270 */       GlStateManager.func_179114_b(-((float)Math.atan(d2 / 40.0D)) * 20.0F, 1.0F, 0.0F, 0.0F);
/* 271 */       entityLivingBase.field_70761_aq = (float)Math.atan(d1 / 40.0D) * 20.0F;
/* 272 */       entityLivingBase.field_70177_z = (float)Math.atan(d1 / 40.0D) * 40.0F;
/* 273 */       entityLivingBase.field_70125_A = -((float)Math.atan(d2 / 40.0D)) * 20.0F;
/*     */     } else {
/* 275 */       entityLivingBase.field_70761_aq = 0.0F;
/* 276 */       entityLivingBase.field_70177_z = 0.0F;
/* 277 */       entityLivingBase.field_70125_A = 0.0F;
/*     */     } 
/* 279 */     entityLivingBase.field_70759_as = entityLivingBase.field_70177_z;
/* 280 */     entityLivingBase.field_70758_at = entityLivingBase.field_70177_z;
/* 281 */     GlStateManager.func_179109_b(0.0F, 0.0F, 0.0F);
/* 282 */     RenderManager renderManager = Minecraft.func_71410_x().func_175598_ae();
/* 283 */     renderManager.func_178631_a(180.0F);
/* 284 */     renderManager.func_178633_a(false);
/* 285 */     Render render = renderManager.func_78713_a((Entity)entityLivingBase);
/*     */     
/* 287 */     ModelPlayer modelPlayer = null;
/* 288 */     if (render instanceof RenderLivingBase) {
/* 289 */       RenderLivingBase renderLivingBase = (RenderLivingBase)render;
/* 290 */       ModelBase modelBase = renderLivingBase.func_177087_b();
/* 291 */       if (modelBase instanceof ModelPlayer) {
/* 292 */         modelPlayer = (ModelPlayer)modelBase;
/*     */       }
/*     */     } 
/*     */     
/* 296 */     if (modelPlayer != null && this.c.v()) {
/* 297 */       modelPlayer.func_178719_a(true);
/*     */     }
/* 299 */     g = this.i.v();
/* 300 */     renderManager.func_188391_a((Entity)entityLivingBase, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F, false);
/* 301 */     g = false;
/*     */     
/* 303 */     renderManager.func_178633_a(true);
/*     */     
/* 305 */     entityLivingBase.field_70761_aq = f1;
/* 306 */     entityLivingBase.field_70177_z = f2;
/* 307 */     entityLivingBase.field_70125_A = f3;
/* 308 */     entityLivingBase.field_70758_at = f4;
/* 309 */     entityLivingBase.field_70759_as = f5;
/* 310 */     GlStateManager.func_179121_F();
/* 311 */     RenderHelper.func_74518_a();
/* 312 */     GlStateManager.func_179101_C();
/* 313 */     GlStateManager.func_179138_g(OpenGlHelper.field_77476_b);
/* 314 */     GlStateManager.func_179090_x();
/* 315 */     GlStateManager.func_179138_g(OpenGlHelper.field_77478_a);
/*     */   }
/*     */   
/*     */   private static boolean g = false;
/*     */   
/*     */   @SubscribeEvent(priority = EventPriority.HIGHEST)
/*     */   public static void v(RenderLivingEvent.Specials.Pre a) {
/* 322 */     if (g)
/* 323 */       a.setCanceled(true); 
/*     */   }
/*     */ }


/* Location:              D:\fanbian\[D][龙之核心]DragonCore-2.6.0.3.jar!\eos\moe\dragoncore\hm.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */